﻿using System;
using System.Collections.Generic;

class GSM
{
    private static string iPhone4S = "IPhone4S, Parametri: ..., Osnovna iNformaciq: ...";
    private string model;
    private string manufacturer;
    private double price;
    private string owner;
    private List<Call> calls = new List<Call>();
    private Battery battery;
    private Display display;
    public GSM(string model, string manufacturer)
    {
        this.model = model;
        this.manufacturer = manufacturer;
        price = 0;
        owner = "";
        battery = new Battery();
        display = new Display();
    }
    public GSM(string model, string manufacturer, double price, string owner)
    {
        this.model = model;
        this.manufacturer = manufacturer;
        this.price = price;
        this.owner = owner;
        battery = new Battery();
        display = new Display();
    }
    public GSM(string model, string manufacturer, double price, string owner, string bModel, int bIdle, int bTalk, BatteryType bType, int dSize, long dColors)
    {
        this.model = model;
        this.manufacturer = manufacturer;
        this.price = price;
        this.owner = owner;
        battery = new Battery(bModel, bIdle, bTalk, bType);
        display = new Display(dSize, dColors);
    }
    public List<Call> CallHistory
    {
        get { return calls; }
    }
    public static string IPhone4S
    {
        get { return iPhone4S; }
    }
    public string Model
    {
        get { return model; }
    }
    public string Manufacturer
    {
        get { return manufacturer; }
    }
    public double Price
    {
        set
        {
            if (value < 0)
            {
                price = 0;
            }
            else
            {
                price = value;
            }
        }
        get { return price; }
    }
    public string Owner
    {
        get { return owner; }
    }
    public void RemoveCall(int call)
    {
        if (call < 0 || call > calls.Count - 1)
        {
            Console.WriteLine("Wrong call");
        }
        else
        {
            calls.RemoveAt(call);
        }
    }
    public void AddCall(Call call)
    {
        calls.Add(call);
    }
    public void RemoveAllCalls()
    {
        calls.RemoveAll(call => call.Duration >= 0);
    }
    public double CalculateTotalPrice(double priceOfCall)
    {
        double totalSumOfCalls = 0;

        foreach (var item in calls)
        {
            totalSumOfCalls = totalSumOfCalls + priceOfCall * item.Duration / 60;
        }
        return totalSumOfCalls;
    }
    public void ShowCalls()
    {
        foreach (var item in calls)
        {
            Console.WriteLine(item.ToString());
        }
    }
    public override string ToString()
    {
        return "Model:" + model + ", manufacturer: " + manufacturer + ", price: " + price + ", owner: " + owner +
            "\n" + battery.ToString() + "\n" + display.ToString();
    }
}

